<template>
<div class="bt-warning">
    <el-popover placement="top" width="248" v-model="visibleDisble">
        <div class="send-box">
            <p class="send-title">发布顺序：</p>
            <el-input v-model="inputSend" placeholder="请输入排序值1～5"></el-input>
        </div>
        <div style="text-align: right; margin: 0">
            <el-button size="mini" type="text" @click="visibleDisble = false">取消</el-button>
            <el-button type="primary" size="mini" @click="BtSend">确定</el-button>
        </div>
        <el-button slot="reference" type="Btsend" v-if="_SHOWBTN(showBetCode)">发布</el-button>
    </el-popover>
</div>
</template>

<script>
export default {
    data() {
        return {
            visibleDisble: false,
            inputSend: "",
        };
    },
    props: ["id", "gettRotationList", "showBetCode"],
    methods: {
        // BlurText(e) {
        //   let boolean = new RegExp("^[1-5]$").test(e.target.value);
        //   if (!boolean) {
        //     this.$message.warning("请输1-5的数字");
        //     e.target.value = "";
        //   }
        // },
        BtSend() {
            let boolean = /^[1-5]$/;
            let res = boolean.test(this.inputSend);
            if (res) {
                // console.log("1111111")
                this.Api.getRotationBtSend({
                    id: this.id,
                    sort: this.inputSend
                }).then(
                    (res) => {
                        // console.log(res, 111);
                        this.$message.success("发布成功");
                        this.gettRotationList();
                        this.visibleDisble = false;
                    }
                );
            } else {
                this.inputSend = "";
                this.$message.warning("请输1-5的数字");
            }
        },
    },
};
</script>

<style lang="less" scoped>
/deep/.el-button--Btsend {
    width: 60px;
    height: 28px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    border-radius: 4px;
    color: white;
    padding: 0;
    background: rgba(32, 163, 91, 1) !important;
}
</style>
